<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    对象,想变成字符串
    想要的结果:var str="username=周洪&password=123456&email=12345@qq.com";

    对象:
    <script>
        var obj={
            username:"徐宁太困",
            password:"222222",
            email:"xuningaikanmeinv@qq.com"
        }
        function queryStingify(obj){
            var str="";//用来接收我的字符串
            for(var k in obj){
                // console.log(k);
                // console.log(obj[k]);
                str+=`${k }=${obj[k]} &`
                // console.log(str);
            }
            str=str.slice(0,-1);//删除最后一个
            return str
        }
        var res=queryStingify(obj)
        console.log(res);
    </script>
</body>
</html>